import connect from './connect'

// 可以使用async await 调用
const asyncQuery = <T>(sql: string): Promise<T> => {
    return new Promise((resolve, reject) => {
        connect.query(sql, (error: Error, result: T) => {
            error ? reject(error) : resolve(result)
        })
    })
}

export default asyncQuery